package Day3;


//import java.sql.Array;
import java.util.Arrays;

/**
 * 名称test01
 * <p>
 * 描述
 *
 * @version 1.0
 * @author:DuanMM
 * @datatime:2024-05-22 16:20
 */
public class test01 {

    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        int[] arr1 = {1,2,3,4,5};
        System.out.println(Arrays.equals(arr,arr1));
        System.out.println("==============");
        int[] arr2 = new int[10];
        Arrays.fill(arr2,1);
        System.out.println(Arrays.toString(arr2));
        Arrays.fill(arr2,1,5,19);
        System.out.println(Arrays.toString(arr2));
    }

    public static void main3(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int[] copy = Arrays.copyOf(arr,arr.length);
        System.out.println(Arrays.toString(copy));
        copy = Arrays.copyOfRange(arr,1,arr.length - 1);
        System.out.println(Arrays.toString(copy));
    }

    public static void main2(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        String str = Arrays.toString(arr);
        System.out.println(str);
//        System.out.println();

    }

    public static void main1(String[] args) {

        int[] arr = {1,2,3,4,5,6};
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        int[] arr1 = new int[10]; //初始化为0
        for (int i : arr1) {
            System.out.print(i + " ");
        }
    }
}
